package Graphics;

import java.awt.Dimension;

import javax.swing.JPanel;
import javax.swing.WindowConstants;

import util.PublicVars;

public class Mainframe extends javax.swing.JFrame {
	private Screen screen;
	private JPanel appletPanel;
	private Dimension fieldSize;
	private SettingsPanel panelSettings;

	public Mainframe() {
		super();
		screen = new Screen();
		fieldSize = new Dimension(PublicVars.getFieldWidth()
				* PublicVars.getNodeSize(), PublicVars.getFieldHeight()
				* PublicVars.getNodeSize());
		appletPanel = new JPanel(true);
		panelSettings = new SettingsPanel();
		
		initGUI();
		setLocationRelativeTo(null);
		setResizable(false);
		setVisible(true);
	}

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
			setLayout(null);

			screen.setSize(fieldSize);
			
			appletPanel = new JPanel();
			appletPanel.setSize(600,580);
			appletPanel.setLayout(null);
			screen.setLocation(0, 0);
			appletPanel.add(screen);
			appletPanel.setLocation(0, 0);
			add(appletPanel);
			screen.init();
			
			
			panelSettings.setLocation(600, 0);
			add(panelSettings);
			// pack();
			setSize(800, 600);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public Screen getScreen() {
		return screen;
	}

	public SettingsPanel getPanelSettings() {
		return panelSettings;
	}

	

}
